Repository navigation
fix(api): preserve text in compact provider SSE data fields - #1397
Closed
darkbloombugs wants to merge 1 commit into
Closed
darkbloombugs wants to merge 1 commit into
darkbloombugs wants to merge 1 commit into
Conversation
|
@darkbloombugs is attempting to deploy a commit to the EigenLabs Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Provider SSE JSON fields permit
data:{...}as well asdata: {...}. Two coordinator response decoders require the space, silently skip the compact form and return successful responses with empty text.Strip
data:before the existing whitespace trim inExtractMessageWithReasoningPolicyandparseStreamChunkChoices. This preserves text for all four non-streaming endpoints and translated Completions, Messages and Responses streams. Ordinary chat streaming already forwards the text and is a passing control. The production change is two lines; decoding and lifecycle ownership stay unchanged.Contract and related work
ProviderLoop+SSEParser.swiftexplicitly implements W3C EventStream framing, including the optional post-colon space; the protocol describes the payload as SSE text. The HTML standard's field parsing rule makes that space optional. This is a supported serialization defect reproduced through the HTTP API. The pinned stock MLX encoder emits the spaced form, so no current stock-provider incident is claimed.Fresh issue/PR deduplication found no usable duplicate. The relocated decoders at the inspected head of open #1056 still require the space; #1365, #1350, #1349 and #1396 cover other behavior. No issue closure is requested.
Before
After
Amber is provider data, blue is existing code flow, red is the lost text, and green is the corrected result.
Validation
Base:
e3575b993cb56f1930b9ee7825c0d0553410e820; Go 1.26.8, darwin/arm64,CGO_ENABLED=0. Unchanged modules, offline Go checks, CPU-only, at most two execution threads and 600-second command caps.go test -p=1 -mod=readonly -count=1 -timeout=500s ./coordinator/tests/api/inference/contracts -run '^TestProviderSSEOptionalSpaceHTTP$'— 7 failures, 9 passing controls. Every failure is HTTP 200 with empty text instead ofHello world.go test -p=1 -mod=readonly -count=1 -timeout=500s ./coordinator/...— 10,286 test/subtest passes, 235 skips, completed in 483 seconds. The repository results verifier confirms all 378 package completions with no missing or duplicate results; all 16 new cases pass in this run too.go vet, module verification and 20 runner guard tests pass.make docs-impact-check BASE=e3575b993cb56f1930b9ee7825c0d0553410e820andmake docs-checkpass (363 documentation files).Skipped checks require disposable PostgreSQL, opt-in media/qualification fixtures, real sidecar binaries, performance opt-in or additional CPU concurrency. They are not counted as passes.
The canonical API contract, consumer quickstart and topical Unreleased changelog are updated. No new fields, configuration, dependency, protocol or release version.
Limits
The regression exercises the real HTTP router, in-memory store, encrypted scripted provider WebSocket, relay, response decoders and HTTP output. The provider uses fixture credentials and synthetic chunks/usage; no model, real account, production database or external inference is used. Existing provider completion supplies authoritative usage. This patch proves text preservation, not full SSE conformance: multiline/named events, BOM handling, metadata normalization and neighboring usage parsers are outside its scope. No live provider, GPU, race-detector, deployment, release or historical-incident qualification is claimed.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.